package si.unimb.rvir;

import com.facebook.android.Facebook;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class login extends Activity {
	
	public static final String APP_ID = "175729095772478";
	private Activity main = this;
	private Facebook fb;
	private Button loginButton;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        fb = new Facebook(APP_ID);
        loginButton = (Button) findViewById(R.id.loginButton);

        loginButton.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
            	fb.authorize(main, new LoginDialogListner(getLogin(), v));
            }
        });
    }
    
    public login getLogin(){
    	return this;
    }
    
    public void changeActivity(View v){
    	Intent i = new Intent(v.getContext(), map.class);
    	startActivityForResult(i, 0);
    }
}